package com.itheima.code;

/**
 * @author jiangxun
 * @date 11-21-2024
 */
public class CodeDemo2 {
    private String name;
    private String[] direction = new String[4];

    /**
     * 实例代码块，无static修饰，属于对象，每次创建对象时，都会优先执行一次。
     * 基本作用：初始化对象的实例资源
     */ {
        System.out.println("实例代码块执行力了：");
        name = "小明";
        direction[0] = "东";
        direction[1] = "西";
        direction[2] = "南";
        direction[3] = "北";
    }

    public static void main(String[] args) {
        System.out.println("main方法执行了：");
        new CodeDemo2();
        new CodeDemo2();
    }
}
